<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>接受公益帮助</title>
    <link rel="stylesheet" type="text/css" href="<?=base_url()?>public/css/style.css">
    <script type="text/javascript" src="<?=base_url()?>public/js/jq.1.12.4.js"></script>
    <script type="text/javascript" src="<?=base_url()?>public/js/js.js"></script>
<style>
.person1 table tr .caozuo{
	position:relative;
	cursor: pointer;
	line-height:20px;
}
.person1 table tr .caozuo span{
		letter-spacing:5px;
}
.person1 table tr .caozuo b{
	font-weight:normal;
}
.content_box>.one{
        position:relative;
    }
.content_box>.one>b{
	position: absolute;
	width: 200px;
	top: 8px;
	right: -200px;
	display:none;
}
.tishi1 {
    position: absolute;
    width: 290px;
    left: 50%;
    margin-left: -105px;
    top: 30%;
    background-color: #f5f5f5;
    color: #525252;
    box-shadow: -5px 5px 10px 1px rgba( 11, 2, 5, 0.3 );
   // display: none;
}


.tishi1 h6 {
    color: #1d3e00;
    text-align: center;
    line-height: 50px;
	font-size:17px;
}
.tishi1 .btn1 {
    text-align: center;
}

.tishi>p{
	height:40px;
}
.tishi>p:after{
	content:"";
	display:table;
	clear:both;
}
.tishi>p.btn{
	padding-bottom:40px;
}
.tishi>p>span{
	display:block;
	width:40%;
	height:40px;
	line-height:40px;
	float:left;
	text-align:right;
}
.tishi>p>b{
	display:block;
	width:60%;
	height:40px;
	line-height:40px;
	float:left;
	text-align:left;
}
</style>
</head>
<body>
	<!-- 头部 -->
    <?php echo $menu ?>
    <!-- 主体 -->
    <div class="main clearfix">
        <?php echo $left ?>
		<div class="content">
			<div class="con">
				<div class="bikuang">
                	<div class="right_title">
                        <span>公益收益中心&nbsp;&nbsp; -</span>
                        <span style="color:#1d3e00; margin:0;">&nbsp;&nbsp;接受公益帮助</span>
                    </div>
                    <div style="border-bottom:1px solid #c0cbb0; padding-bottom:20px; width:100%; margin:0 auto;box-shadow: -3px 3px 6px 0px rgba( 29, 62, 0, 0.2 );">
					    <?php echo form_open('accept_help/info_post', array('id'=>'myform')); ?>
                        <div class="person">
                        	<span style='float:left;width:16%;color:#1d3e00;text-align:right;'>选择钱包</span>
                            <div class="face" style="line-height:24px; color:#525252; margin-left:20%;">
                                <input type="radio" name="order_type" value="0" checked="checked" id='radio' />
                                公益静态钱包（<span id="jt_ye"><?=$user['jt_money']?></span>）&nbsp;&nbsp;
                                <input type="radio" style='margin-left:8%' name="order_type" value="1"  />
                                公益推广钱包（<span id="tg_ye"><?=$user['tg_money']?></span>）
								<input type="hidden" name="maxmoney" id="maxmoney" value="<?php echo  $maxmoney ?>" />
                            </div>
                            <div style="clear:both;"></div>

                            <p><span style='width:16%;color:#1d3e00;text-align:right;'>金额</span>
							<input type="text" name="money" id="money" value="" maxlength='7'><b class='js-b'></b>
							</p>
                            <p style='margin-left:20%;' class="biaozhu">公益静态钱包：2000起提现100的倍数<br>
                            公益推广钱包：1000起提现500的倍数</p>
                            <p class="btn"><span style='margin-left:34%; width:30%;position:relative;' id="btn_add">确认申请</span></p>

                        </div>
                        </form>


                        <div id="msg_box" class="tishi1">
                        	<h6>是否确认收款</h6>
                            <p class="btn1">
                                <input id="btn_sk_on" type="button" value="是" name="是">
                                <input id="btn_sk_off" type="button" value="否" name="否">
                            </p>
                        </div>

                    </div>
                    <div class="right_title">
                    <span>公益收益中心&nbsp;&nbsp; -</span>
                    <span style="color:#1d3e00; margin:0;">&nbsp;&nbsp;接受公益帮助订单</span>
                    </div>
                    <div class="person1">
                    	<table cellpadding="0" cellspacing="0">
                        	<tr>
                            	<th>公益编号</th>
                                <th>申请日期</th>
                                <th>收益金额</th>
                                <th>钱包</th>
                                <th style='width:220px;'>剩余收款时间</th>
                                <th>合作人信息</th>
                                <th>状态</th>
                                <th>操作</th>
                                <th>打款凭证</th>
                            </tr>
                            <?php foreach($log_list as $log): ?>
                            <tr>
                                <td><?php
									$bianhao = $this->common->getnumChar ( 7 );
									echo $bianhao;
									?></td>
                                <td class="number"><?php echo date('Y-m-d H:i:s',$log['sq_time']) ?></td>
                                <td><?php echo $log['money'] ?></td>
                                <td><?php echo $order_type[$log['order_type']] ?></td>
                                <td style='width:220px;'>
                                    <?php
                                        if($log['dakuan'] == 1 && $log['dakuan_time'] != 0)
                                        {
                                            if($log['shoukuan'] == '1'){
                                                echo '已完成';
                                            }else{
                                                $sy_time = 43200 - ((time() - $log['dakuan_time']));
                                                if($sy_time > 0 ){
                                                    echo '<span class="settime" endTime="'.$sy_time .'"></span>';
                                                }else{
                                                    echo '已完成';
                                                }
                                            }
                                        }
                                    ?>
                                </td>
                                <td class=" caozuo chakan">
                                    <span class="btn_show" style='color:blue;'>查看</span>
                                    <div class="tishi" style='width:301px;left:-160%;top:-504%;'>
										<?php $three_hours = time() - $log['pp_time'];?>
										<?php if($three_hours > 10800 || $log['dakuan'] == 1): ?>
                                        <p><span>公益账号：</span><b><?php echo substr_replace($log['user_account'],'***',3,3) ?></b></p>
                                        <p><span>姓名：</span><b><?php echo $log['user_name'] ?></b></p>
                                        <p><span>电话：</span><b><?php echo $log['mobile'] ?></b></p>
										<p><span>支付宝号：</span><b><?php echo $log['zfb_account'] ?></b></p>
                                        <p><span>微信号：</span><b><?php echo $log['wx_id'] ?></b></p>
										<?php else:?>
										<p><span>公益账号：</span><b><?php echo substr_replace($log['user_account'],'***',3,3) ?></b></p>
                                        <p><span>姓名：</span><b><?php echo $log['user_name'] ?></b></p>
                                        <p><span>电话：</span><b><?php echo substr_replace($log['mobile'],'****',3,4) ?></b></p>
										<p><span>支付宝号：</span><b><?php echo substr_replace($log['zfb_account'],'***',3,3) ?></b></p>
                                        <p><span>微信号：</span><b><?php echo substr_replace($log['wx_id'],'***',3,3) ?></b></p>
										<?php endif;?>
										<!--<p><span>支付宝号：</span><b><?php echo substr_replace($log['zfb_account'],'***',3,3) ?></b></p>
                                        <p><span>微信号：</span><b><?php echo substr_replace($log['wx_id'],'***',3,3) ?></b></p>-->
                                        <p><span>银行账号：</span><b><?php echo $log['bank_card'] ?></b></p>
                                        <p><span>匹配金额：</span><b><?php echo $log['money'] ?></b></p>
                                        <p><span>匹配时间：</span><b><?php echo date("Y-m-d H:i:s",$log['pp_time']) ?></b></p>
										<?php if($three_hours > 10800 || $log['dakuan'] == 1): ?>
                                        <p><span>推荐人姓名：</span><b><?php echo $log['up_user_name'] ?></b></p>
                                        <p><span>电话：</span><b><?php echo $log['up_mobile'] ?></b></p>
										<?php else:?>
										<p><span>推广人姓名：</span><b><?php echo substr_replace($log['up_user_name'],'***',3,3) ?></b></p>
                                        <p><span>电话：</span><b><?php echo substr_replace($log['up_mobile'],'***',3,3) ?></b></p>
										<?php endif;?>
                                        <p class="btn"><input class="btn_close" type="button" value="关闭" name="关闭"></p>
                                    </div>
                                </td>
                                <td><?php echo $dakuan_type[$log['dakuan']] ?></td>
                                <td class="caozuo" style='line-height:30px;'>
                                    <?php if($log['dakuan'] == 1 && $log['shoukuan'] == 0): ?>
                                        <b class="dakuan"  style='color:blue;' url="<?php echo site_url('accept_help/change_shoukuan_type/1/'.$log['id']) ?>">确认收款</b><br>
                                        <b class='buda'  style='color:red;' url="<?php echo site_url('accept_help/change_shoukuan_type/2/'.$log['id']) ?>">未收到款</b>
                                    <?php else:?>
                                    <?php  $str_arr = array(0=>'',1=>'已收款',2=>'未收款',4=>'');echo $str_arr[$log['shoukuan']]; ?>
                                    <?php endif; ?>
                                </td>
                                <td class="green">
                                    <?php if($log['dakuan'] == 1): ?>
                                        <a href="<?php echo base_url().'uploads/'.$log['img_url'] ?>" target="_blank">查看</a>
                                    <?php endif; ?>
                                </td>
                            </tr>
                            <?php endforeach; ?>
                        </table>
                    </div>
				</div>
			</div>
		</div>

	</div>

	<div style='position:fixed;width:18%;height:220px;background:rgba(133,220,75,0.7);color:white;top:42%;left:53%;text-align:center;line-height:220px;display:none;' class='js-tishi' >dwadwadaw</div>
<script type="text/javascript">
$(function(){
	$('#btn_add').on('mousedown',function(){
									$('#btn_add').css('top','5px');
								})
								$('#btn_add').on('mouseup',function(){
									$('#btn_add').css('top','0px');
								})
	$('.js-tishi').on('click',function(){
		$('.js-tishi').css('display','none');
	})
    $('#btn_add').on('click', function(event) {
        if($('#money').val() == ''){
		 $('.js-b').text('请输入金额');
            //alert('请输入金额');
            return false;

        }else{
			$('.js-b').text('');
		}
		if($(":radio:checked").attr("id")=="radio"){
			if($('#money').val()<2000){
				$('.js-b').text('必须大于2000');
				return false;
			}else if($('#money').val()%100!=0){
				$('.js-b').text('必须是100的倍数');
				return false;
			}
/*			else if($('#money').val()>10000){
				$('.js-b').text('必须小于10000');
				return false;
			}
*/
			else if($('#money').val()>parseFloat($('#jt_ye').html())){
				$('.js-b').text('余额不足');
				return false;
			}
			else{
				$('.js-b').text('');
			}

		}else{
			if($('#money').val()<1000){
				$('.js-b').text('必须大于1000');
				return false;
			}else if($('#money').val()%500!=0){
				$('.js-b').text('必须是500的倍数');
				return false;
			}else if($('#money').val()>$('#maxmoney').val()){
				$('.js-b').text('当前级别当日限额'+$('#maxmoney').val());
				return false;
			}
			else if($('#money').val()>parseFloat($('#tg_ye').html())){
				$('.js-b').text('余额不足');
				return false;
			}
			else{
				$('.js-b').text('');
			}
		}
        $('#myform').submit();
    });

    //收款按钮点击
    $('.dakuan').on('click',function(){
        var url = $(this).attr('url');
		$('#msg_box').hide();
        $('#msg_box').show();
		$('#msg_box>h6').text('是否确认收款');


        $('#btn_sk_on').on('click',function(){
            location.href=url;
        })
    });
	$('.buda').on('click',function(){

        var url = $(this).attr('url');
		$('#msg_box').hide();
        $('#msg_box').show();
		$('#msg_box>h6').text('是否确未收到款');


        $('#btn_sk_on').on('click',function(){
            location.href=url;
        })
    });
	$("#msg_box #btn_sk_off").click(function(){
		$("#msg_box").hide();
	});

    $('.btn_show').on('click',function(){
		 $('.btn_show').next().hide();
        $($(this).next()).show();
        $('.btn_close').on('click',function(){
            $('.tishi').hide();
        })


    })
	// var sile = true
	// $(".chakan").click(function(){
	// 	if(sile == true){
	// 		$(this).find( ".tishi").css({display:"block"})
	// 		var account=$(".tishi>p:first-child>b").html();
	// 		var mobile=$(".tishi>p:nth-child(3)>b").html();
	// 		var zfb=$(".tishi>p:nth-child(4)>b").html();
	// 		var wx=$(".tishi>p:nth-child(5)>b").html();
	// 		var upco=$(".tishi>p:nth-child(9)>b").html();
	// 		var uptel=$(".tishi>p:nth-child(10)>b").html();
	// 		$(".tishi>p:first-child>b").html(account.slice(0,2)+"***"+account.slice(5));
	// 		$(".tishi>p:nth-child(3)>b").html(mobile.slice(0,2)+"***"+mobile.slice(5));
	// 		$(".tishi>p:nth-child(4)>b").html(zfb.slice(0,2)+"***"+zfb.slice(5));
	// 		$(".tishi>p:nth-child(5)>b").html(wx.slice(0,2)+"***"+wx.slice(5));
	// 		$(".tishi>p:nth-child(9)>b").html(upco.slice(0,2)+"***"+upco.slice(5));
	// 		$(".tishi>p:nth-child(10)>b").html(uptel.slice(0,2)+"***"+uptel.slice(5));
	// 		sile = false
	// 	}else{
	// 		$(".tishi").css({display:"none"})
	// 		sile = true
	// 	}
	// })
})


// var sile = true
// $(".person1 table tr .chakan").click(
// 	function(){
// 		if(sile == true){
// 		$(".tishi").css({display:"block"})
// 		sile = false
// 		}else{
// 			$(".tishi").css({display:"none"})
// 			sile = true
// 			}
// })
// var sile = true
// $(".person1 table tr td .dakuan").click(
// 	function(){
// 		if(sile == true){
// 		$(".tishi1").css({display:"block"})
// 		sile = false
// 		}else{
// 			$(".tishi1").css({display:"none"})
// 			sile = true
// 			}
// })

// $(".tishi .btn input").click(
// 	function(){
// 		$(".tishi").css({display:"none"})
// 		})
</script>
</body>
</html>
<script type="text/javascript">
    $(function(){

        updateEndTime();
        $('.btn_chakan').on('click', function(event) {
            $($(this).next()).show();
        });
    });
    //遍历倒计时
    function updateEndTime(){
        $(".settime").each(function(i){
            var lag = this.getAttribute("endTime");//(endTime - time) / 1000; //当前时间和结束时间之间的秒数
            $(this).attr("endTime",lag-1);
            if(lag > 0)
            {
                var time_str = '';
                if(lag > 86400){
                    time_str += Math.floor((lag / 3600) / 24)+'天';
                     console.log(time_str);
                }
                if(lag >3600){
                    time_str += Math.floor((lag / 3600) % 24)+"小时";
                     console.log(time_str);
                }
                if(lag > 60)
                {
                    time_str += Math.floor((lag / 60) % 60)+"分";
                     console.log(time_str);
                }
                if(lag > 0)
                {
                    time_str += Math.floor(lag % 60)+"秒";
                     console.log(time_str);
                }

                $(this).html(time_str);
            }
            else{
                $(this).removeClass("settime");
                $(this).html("已过期");
            }
        });
        setTimeout("updateEndTime()",1000);
    }
</script>
